<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组使用代理拦截操作</title>
</head>
<body>
    
</body>
<script>
    let lesson = [
        {title:'Vue.js',click:2200},
        {title:'Node.js',click:1100},
        {title:'mysql',click:1500}
    ]
    lesson[1].title.substring
    let proxy = new Proxy(lesson,{
        get(arr,key){  //这里的key就是外部传入的数据
            let length = 3
            return arr[key].title.length>=length?arr[key].title.substr(0,length)+'.'.repeat(3):arr[key].title
        }
    })
    console.log(proxy[2])
</script>
</html>